package com.xhx.stream.stream;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.integration.support.MessageBuilder;

import com.xhx.stream.dto.HumanDTO;
import com.xhx.stream.dto.VehicleDTO;

/**
 * 自定义消息发送器
 * 
 * @author xhx
 */
@EnableBinding(CustomSourceChannel.class)
public class CustomSendPublisher {
	@Autowired
	private CustomSourceChannel sourceChannel;

	public void sendLogMsg(String msg) {
		sourceChannel.logOutput().send(MessageBuilder.withPayload(msg).build());
	}

	public void sendFaceMsg(String msg) {
		sourceChannel.faceOutput().send(MessageBuilder.withPayload(msg).build());
	}

	public void sendHumanMsg(HumanDTO msg) {
		sourceChannel.humanOutput().send(MessageBuilder.withPayload(msg).build());
	}

	public void sendVehicleMsg(VehicleDTO msg) {
		sourceChannel.vehicleOutput().send(MessageBuilder.withPayload(msg).build());
	}
}
